package com.cpa.admin.vo;

import com.cpa.admin.model.UserDo;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.math.BigDecimal;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author zhen.zhao01
 * @CreateDate 2018/11/3
 */
@Data
public class UserVo {

    private String id;

    /**用户名*/
    private String username;

    /**项目名称*/
    private String productName;

    /**推广项目数量*/
    private Long productCount;

    /**当前推广获取的金额*/
    private BigDecimal currentAmount;

    /**账户总推荐金额*/
    private BigDecimal accountAmountCount;

    /**结算推送时间*/
    private LocalTime settleAmountPushTime;

    /**最后结算时间*/
    private Date lastSettleAmountTime;

    /**状态*/
    private String status;

    /**昨日量*/
    private Long yesterdayCount;

    public UserVo() {
    }

    public UserVo(String id, String username, String productName, Long productCount, BigDecimal currentAmount, BigDecimal accountAmountCount, LocalTime settleAmountPushTime, Date lastSettleAmountTime, String status, Long yesterdayCount) {
        this.id = id;
        this.username = username;
        this.productName = productName;
        this.productCount = productCount;
        this.currentAmount = currentAmount;
        this.accountAmountCount = accountAmountCount;
        this.settleAmountPushTime = settleAmountPushTime;
        this.lastSettleAmountTime = lastSettleAmountTime;
        this.status = status;
        this.yesterdayCount = yesterdayCount;
    }

    public static UserVo convert(UserDo userDo) {
        UserVo vo = new UserVo();
        BeanUtils.copyProperties( userDo,vo);
        return vo;
    }


    public static List<UserVo> convert(List<UserDo> userDos) {
        List<UserVo> userVos = new ArrayList<>(userDos.size());
        for (UserDo userDo : userDos) {
            userVos.add(UserVo.convert(userDo));
        }

        return userVos;
    }


}
